package _08Comparator比较器排序;

import _07Comparable自然排序.Student;

import java.util.Comparator;
import java.util.TreeSet;

public class StudentDemo {
    public static void main(String[] args) {

        TreeSet<Student> students = new TreeSet<>(new Comparator<Student>() {
            @Override
            public int compare(Student o1, Student o2) {
                return o2.getAge()-o1.getAge();
            }
        });

        students.add(new _07Comparable自然排序.Student("aaa",18));
        students.add(new _07Comparable自然排序.Student("bbb",17));
        students.add(new Student("ccc",19));

        System.out.println(students);
    }
}
